package com.novak.rss.reader;




import com.novak.rss.reader.R;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.text.Html;
import android.text.Spanned;
import android.text.method.LinkMovementMethod;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.TextView;

public class ShowFeedActivity extends Activity
{

  private TextView msgTitle;
  private TextView msgDescription;
  private TextView msgURL;

  @Override
  public void onCreate(Bundle savedInstanceState)
  {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.newscontent);
    msgTitle = (TextView) findViewById(R.id.myTitle);
    msgDescription = (TextView) findViewById(R.id.myDesc);
    msgURL = (TextView) findViewById(R.id.myLink);

    Intent intent = this.getIntent();
    Bundle bundle = intent.getExtras();
    msgTitle.setText(bundle.getString("title"));
    String body = bundle.getString("description");
    Spanned ts = Html.fromHtml(body);
    msgDescription.setText(ts);
    StringBuffer sb = new StringBuffer();
    sb.append("<a href=\"").append(bundle.getString("url")).append("\">查看原文</a>");
    ts = Html.fromHtml(sb.toString());
    msgURL.setText(ts);
    msgURL.setMovementMethod(LinkMovementMethod.getInstance());  
    //msgURL.setText(bundle.getString("url"));
   // Linkify.addLinks(msgURL, Linkify.WEB_URLS);
  }
  public boolean onCreateOptionsMenu(Menu menu)
  {
    menu
        .addSubMenu(0, 2, 0, getResources().getString(R.string.backwards));
    return true;
  }

  @Override
  public boolean onOptionsItemSelected(MenuItem item)
  {
    setResult(0);
    finish();
    return true;
  }

}
